//
//  QSShowAlertViewTool.m
//  ZengLongSeSha
//
//  Created by apple on 2017/6/22.
//  Copyright © 2017年 Song. All rights reserved.
//

#import "QSShowAlertViewTool.h"
#import "QSUniversalTool.h"

@implementation QSShowAlertViewTool
SingleImplementation(QSShowAlertViewTool);

/**
 *  最基础的提示框
 */
- (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message andActionTitle:(NSString *)actionTitle
{
    UIAlertController *alertC = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:actionTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    [alertC addAction:cancelAction];
    
    UIViewController *currentVC = [[QSUniversalTool shareQSUniversalTool] getCurrentVC];
    [currentVC presentViewController:alertC animated:YES completion:^{
    }];
}

/**
 *  带两个按钮的提示框
 */
- (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message cancelActionTitle:(NSString *)cancelActionTitle sureActionTitle:(NSString *)sureActionTitle andSureActionBlock:(void (^ _Nullable)())sureActionBlock
{
    UIAlertController *alertC = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancelActionTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    UIAlertAction *sureAction = [UIAlertAction actionWithTitle:sureActionTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        sureActionBlock();
    }];
    
    [alertC addAction:cancelAction];
    [alertC addAction:sureAction];
    
    UIViewController *currentVC = [[QSUniversalTool shareQSUniversalTool] getCurrentVC];
    [currentVC presentViewController:alertC animated:YES completion:^{
    }];
}
@end
